let obj = {
  a: 1,
  b: {
    n: 2
  }
}

function deepClone(obj) {
  return new Promise(resolve => {
    const {port1, port2} = new MessageChannel()
    port1.postMessage(obj)
    port2.onmessage = function(msg) {
      resolve(msg.data)
    }
  })
  
}

deepClone(obj).then(res => {
  obj.b.n = 20
  console.log(res);
  
})